<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page import="free.akerigan.yafb2lib.model.BookModel"%>
<%@page import="free.akerigan.yafb2lib.library.LibraryModel"%>
<%@page import="free.akerigan.yafb2lib.model.AuthorModel"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="PRAGMA" content="no-cache" />
<title>Contents of library</title>
</head>
<body>
Список книг:
<br />
<table border="1" cellpadding="0" cellspacing="0">
	<thead>
		<th>Книга</th>
		<th>Аннотация</th>
	</thead>
	<%
	    LibraryModel library = (LibraryModel) application
			    .getAttribute("library");
	    BookModel bookModel;
	    String authorId;
	    for (int i = 0; i < library.getSize(); i++) {
			bookModel = library.getBookModel(i);
	%>
	<tr>
		<td>
		<%
		    for (int j = 0; j < bookModel.getAuthorsCount(); j++) {
				    authorId = bookModel.getAuthorId(j);
				    if (j > 0) {
					out.println(",");
				    }
				    out.println(authorId);
				}
		%>
		</td>
		<td rowspan="4">
		<%
		    out.println(bookModel.getAnnotation());
		%>
		</td>
	</tr>
	<tr>
		<td>
		<%
		    out.println(bookModel.getTitle());
		%>
		</td>
	</tr>
	<tr>
		<td>
		<%
		    out.println(bookModel.getGenre());
		%>
		</td>
	</tr>
	<tr>
		<td>
		<%
		    out.println("year: " + bookModel.getDate());
		%>
		</td>
	</tr>
	<%
	    }
	%>
</table>
</body>
</html>